package RangedGenerics;

import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Student s1 = new Student("雷军",45);
        Student s2 = new Student("史蒂夫 - 乔布斯",78);
        Student s3 = new Student("董明珠",54);
        Student s4 = new Student("马化腾",48);
        Student s5 = new Student("任正非",68);

        Student[] students = new Student[5];
        students[0] = s1;
        students[1] = s2;
        students[2] = s3;
        students[3] = s4;
        students[4] = s5;

        System.out.println("排序前");

        for(Student s:students){
            s.print();
        }

        arraySort(students);

        System.out.println("排序后");

        for(Student s:students){
            s.print();
        }

    }

    //用来进行排序的有界泛型方法，只接受实现了 Comparable 接口的类
    public static <T extends Comparable<T>> T[] arraySort(T[] array)
    {
        Arrays.sort(array);
        return array;
    }
}
